package com.tj.collection.enums;

/**
 * Author: Karl
 * Date: 2020/12/17 6:24 下午
 */
public enum ClSexEnum {
    FEMALE(0, "female"),
    MALE(1, "male"),
    OTHER(2, "other"),
    ;

    private Integer sex;
    private String desc;

    ClSexEnum(Integer sex, String desc) {
        this.sex = sex;
        this.desc = desc;
    }

    public Integer getSex() {
        return sex;
    }

    public  ClSexEnum setSex(Integer sex) {
        this.sex = sex;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public  ClSexEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static  ClSexEnum getEnum(Integer type) {
        for ( ClSexEnum enumObj :  ClSexEnum.values()) {
            if (enumObj.getSex().equals(type)) {
                return enumObj;
            }
        }
        return null;
    }
}
